package com.zfei.gfb.query;

import com.zfei.gfb.bean.Const;
import com.zfei.gfb.bean.Page;
import com.zfei.gfb.bean.Status;
import com.zfei.gfb.bean.StatusException;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * @author fgh
 */
public class GfbCompanyQuery extends Page {


    // 企业名称
    @ApiModelProperty(value = "企业名称", required = false)
    private String name;

    @ApiModelProperty(value = "账号状态", required = false)
    private Integer status;

    // 状态1:已审核 0:未审核 2:已拒绝
    @ApiModelProperty(hidden = true)
    private Integer audit;

    public void setName(String value) {
        this.name = value;
    }

    public String getName() {
        return this.name;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getAudit() {
        return audit;
    }

    public void setAudit(Integer audit) {
        this.audit = audit;
    }

    public Page check(){
        if(!Const.legalStatus(status)){
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        if(name != null && name.length() > 64){
            throw new StatusException(Status.INVALID_ARGUMENT);
        }
        return this;
    }
}

